package cn.kgc.vue.config;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * @author 课工场
 * @date 2023/12/4
 * @description Swagger2接口文档工具配置
 */
@Configuration
@EnableSwagger2
public class KgcSwagger2Config {

    @Bean
    public Docket docket() {
        return new Docket(DocumentationType.SWAGGER_2)
                .groupName("Java2322")
                .apiInfo(apiInfo())
                .select()
                .apis(RequestHandlerSelectors.withClassAnnotation(Api.class))
                .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
                .build();
    }

    private ApiInfo apiInfo() {
        return new ApiInfoBuilder()
                .title("KGC智慧教育平台后台接口文档")
                .description("该项目是一个前后端分离项目<br>" +
                        "前端技术栈:Vue+Element-UI+Axios<br>" +
                        "后端技术栈:SpringBoot+MyBatis-plus+Redis+MySql+Shiro")
                .version("1.0")
                .contact(new Contact("Java2322", "http://www.bdqnhf.com", "bdqnhf@kgc.com"))
                .build();
    }

}
